<?php
/* *****************************************************************
 * @Author: wushuiyong
 * @Created Time : 日 10/18 15:41:42 2015
 *
 * @File Name: components/Repo.php
 * @Description:
 * *****************************************************************/
namespace app\common;


use app\models\ProjectModel;

class Repo extends Command {

    /**
     * 获取版本管理句柄
     *
     * @param $config
     * @return Git|Svn
     * @throws \Exception
     */
    public static function getRevision($config) {
        switch ($config->repo_type) {
            case ProjectModel::REPO_TYPE_GIT:
                return new Git($config);
            case ProjectModel::REPO_TYPE_SVN:
                return new Svn($config);
            default:
                throw new \Exception("未知的版本管理");
                break;
        }
    }
}